package com.hanter.android.radlib.memo;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * 类名：PageStorage <br/>
 * 描述：保存状态
 * 创建时间：2016/09/02 13:25
 *
 * @author wangmingshuo
 * @version 1.0
 */
public class PageStorage implements Parcelable {
    private PageMemento memento;

    public PageStorage(PageMemento memento) {
        this.memento = memento;
    }

    public PageMemento getMemento() {
        return memento;
    }

    public void setMemento(PageMemento memento) {
        this.memento = memento;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeParcelable(this.memento, flags);
    }

    protected PageStorage(Parcel in) {
        this.memento = in.readParcelable(PageMemento.class.getClassLoader());
    }

    public static final Parcelable.Creator<PageStorage> CREATOR = new Parcelable.Creator<PageStorage>() {
        @Override
        public PageStorage createFromParcel(Parcel source) {
            return new PageStorage(source);
        }

        @Override
        public PageStorage[] newArray(int size) {
            return new PageStorage[size];
        }
    };
}
